<?php
namespace brenda_template{
	
	class Lexical_Component{
		
		protected $_lexical_components = array(
			"var"=>array(
				"name"=>"var",
				"literal"=>"%variable",
				"pattern"=>'/^(\%[a-zA-Z_^\n]+[0-9]*)$/D',
				"required"=>array("separator","close_parentheses"),
			),
			"point"=>array(
				"name"=>"access identifier",
				"literal"=>".",
				"pattern"=>'/^\.$/D',
				"required"=>array("identifier"),
			),
			"identifier"=>array(
				"name"=>"identifier",
				"literal"=>"text",
				"pattern"=>'/^[a-zA-Z_]+$/D',
				"required"=>array("delimiter","open_parentheses"),
			),
			"open_parentheses"=>array(
				"name"=>"open parentheses",
				"literal"=>"(",
				"pattern"=>'/^\($/D',
				"required"=>array("double_quote","single_quote","var","close_parentheses"),
			),
			"close_parentheses"=>array(
					"name"=>"close parentheses",
					"literal"=>")",
					"pattern"=>'/^[\)]$/D',
					"required"=>array("open_object"),
			),
			"plus"=>array(
					"name"=>"plus",
					"literal"=>"+",
					"pattern"=>'/^\+$/D',
					"required"=>array("double_quote","single_quote"),
			),
			"tab"=>array(
				"name"=>"tab",
				"literal"=>"tab",
				"pattern"=>"/^\t$/D",
				"required"=>null,
			),
			"new_line"=>array(
				"name"=>"new line",
				"literal"=>"new line",
				"pattern"=>"/^\n$/D",
				"required"=>null,
			),
			"single_quote"=>array(
				"name"=>"single quote",
				"literal"=>"'",
				"pattern"=>'/^\'[^\']*[\n]*\'$/D',
				"required"=>array("close_object","separator","plus"),
			),
			"separator"=>array(
				"name"=>"separator",
				"literal"=>",",
				"pattern"=>'/^\,$/D',
				"required"=>array("identifier","var"),
			),
			"double_quote"=>array(
				"name"=>"double quote",
				"literal"=>'"',
				"pattern"=>'/^\"[^\"]*[\n]*\"$/D',
				"required"=>array("close_object","separator","plus"),
			),
			"final_instruction"=>array(
				"name"=>"final of instruction",
				"literal"=>'"',
				"pattern"=>'/^\;$/D',
				"required"=>array("close_object","separator","plus"),
			),
			"delimiter"=>array(
				"name"=>"delimiter",
				"literal"=>":",
				"pattern"=>'/^:$/D',
				"required"=>array("open_object","single_quote","double_quote","identifier"),
			),
			"white_space"=>array(
				"name"=>"white space",
				"literal"=>"' '",
				"pattern"=>'/^ $/D',
				"required"=>null,
			),
			"open_object"=>array(
				"name"=>"open object",
				"pattern"=>'/^\{$/D',
				"literal"=>"'{'",
				"required"=>array("identifier","var","close_object"),
			),
			"close_object"=>array(
				"name"=>"open object",
				"literal"=>"'}'",
				"pattern"=>'/^\}$/D',
				"required"=>array("close_object","separator","open_object","var","identifier",null),
			)
		);
		
		protected $_lexical_component_omited = array(
				"new_line",
				"tab",
				"white_space"
		);
		
		protected $_keywords = array(
			"function",
			"return"
		);
		
		protected $_open_bt = array(
			"name"=>"open brenda template",
			"literal"=>"%{",
			"pattern"=>'/^\%\{$/D',
			"required"=>null
		);
		
		protected $_close_bt = array(
			"name"=>"close brenda template",
			"literal"=>"}%",
			"pattern"=>'/^\}\%$/D',
			"required"=>null
		);
	}
}
?>